<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: OpenSocial::RpcRequest</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">OpenSocial::RpcRequest</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/opensocial/request_rb.html">
                lib/opensocial/request.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Request.html">
                Request
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Provides a wrapper for a single RPC request to an OpenSocial endpoint,
composed of one or more individual requests.
</p>
<p>
The <a href="RpcRequest.html">RpcRequest</a> class wraps an HTTP request to
an OpenSocial endpoint for social data. An <a
href="RpcRequest.html">RpcRequest</a> is intended to be used as a container
for one or more Requests (or Fetch*Requests), but may also be used with a
manually constructed post body. The <a
href="RpcRequest.html">RpcRequest</a> class uses <a
href="../OAuth.html">OAuth</a> signing inherited from the <a
href="Request.html">Request</a> class, when appropriate <a
href="../OAuth.html">OAuth</a> credentials are supplied.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000036">add</a>&nbsp;&nbsp;
      <a href="#M000035">new</a>&nbsp;&nbsp;
      <a href="#M000037">send</a>&nbsp;&nbsp;
      <a href="#M000038">send_request</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">requests</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines the requests sent in the single <a
href="RpcRequest.html">RpcRequest</a>. The requests are stored a key/value
pairs.

</td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000035" class="method-detail">
        <a name="M000035"></a>

        <div class="method-heading">
          <a href="RpcRequest.src/M000035.html" target="Code" class="method-signature"
            onclick="popupCode('RpcRequest.src/M000035.html');return false;">
          <span class="method-name">new</span><span class="method-args">(connection, requests = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Initializes an <a href="RpcRequest.html">RpcRequest</a> with the supplied
connection and an optional hash of requests.
</p>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000036" class="method-detail">
        <a name="M000036"></a>

        <div class="method-heading">
          <a href="RpcRequest.src/M000036.html" target="Code" class="method-signature"
            onclick="popupCode('RpcRequest.src/M000036.html');return false;">
          <span class="method-name">add</span><span class="method-args">(requests = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Adds one or more requests to the <a href="RpcRequest.html">RpcRequest</a>.
Expects a hash of key/value pairs (key used to refernece the data when it
returns =&gt; the <a href="Request.html">Request</a>).
</p>
        </div>
      </div>

      <div id="method-M000037" class="method-detail">
        <a name="M000037"></a>

        <div class="method-heading">
          <a href="RpcRequest.src/M000037.html" target="Code" class="method-signature"
            onclick="popupCode('RpcRequest.src/M000037.html');return false;">
          <span class="method-name">send</span><span class="method-args">(unescape = true)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sends an <a href="RpcRequest.html">RpcRequest</a> to the OpenSocial
endpoint by constructing JSON for the POST body and delegating the request
to <a href="RpcRequest.html#M000038">send_request</a>. If an <a
href="RpcRequest.html">RpcRequest</a> is sent with an empty list of
requests, an exception is thrown. The response JSON is optionally unescaped
(defaulting to true).
</p>
        </div>
      </div>

      <div id="method-M000038" class="method-detail">
        <a name="M000038"></a>

        <div class="method-heading">
          <a href="RpcRequest.src/M000038.html" target="Code" class="method-signature"
            onclick="popupCode('RpcRequest.src/M000038.html');return false;">
          <span class="method-name">send_request</span><span class="method-args">(post_data, unescape)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sends an <a href="RpcRequest.html">RpcRequest</a> to the OpenSocial
endpoint by constructing the service URI and dispatching the request. This
method is public so that an arbitrary POST body can be constructed and
sent. The response JSON is optionally unescaped.
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>